{extend name="base"}
{block name="main"}
<div id="app" v-cloak>
	<el-menu mode="horizontal" :default-active="wsNav.activeIndex">
		<el-menu-item :index="v.name" v-for="v of nav" class="p0">
			<a class="block p_x20" :href="v.href" v-text="v.title"></a>
		</el-menu-item>
	</el-menu>

	<el-row class="ws-quote">
		<el-col span="24">
			<el-button @click="onSubmit(true,'{:url(\'del\')}',{table:'tasking',ids:checkData})" :disabled="!checkData.length" type="danger" size="small">删除</el-button>
			<el-button @click="onGet('{:url(\'clearAll\')}',true)" type="danger" size="small">清空任务列表</el-button>
		</el-col>
	</el-row>

	<el-table @selection-change="selectionChange" :data="tableData" border stripe>
		<el-table-column type="selection" width="40"></el-table-column>
		<el-table-column prop="id" label="编号" sortable></el-table-column>
		<el-table-column prop="title" label="标题"></el-table-column>
		<el-table-column prop="msg" label="信息内容"></el-table-column>
		<el-table-column prop="remark" label="说明"></el-table-column>
		<el-table-column prop="s_time" label="创建时间" sortable :formatter="dateFormats"></el-table-column>
		<el-table-column prop="start_time" label="执行时间" sortable :formatter="startTaskFormats"></el-table-column>
		<el-table-column label="操作">
			<template slot-scope="scope">
				<el-button type="danger" size="mini" v-if="wxmsg_task_id!=scope.row.id" @click="onGet('{:url(\'del\')}?table=tasking&id='+scope.row.id,true)">删除</el-button>
			</template>
		</el-table-column>
	</el-table>
	
	<div class="page">{$list->render()|raw}</div>
</div>
{/block}

<!--------------------------分割线------------------------>
<!--------------------------分割线------------------------>
<!--------------------------分割线------------------------>

{block name="vue"}
<script type="text/babel" type="text/javascript">
var app=new Vue({
	el:'#app',
	mixins:[wsMixins],
	data:{
		tableData:{$list->toJson()|raw}, // 列表数据
		checkData:[], // 选中数据
		nav:{$_nav|stripslashes|raw},
		wxmsg_task_id:{$user.wxmsg_task_id|default=0},
	},
	methods:{
		// 用户选择发生改变
		selectionChange(data){
			this.checkData=data.map(item=>{
				return item.id;
			})
		},
	}
});
</script>
{/block}